package com.xiaoshuidi.cloud.module.contract.mq.producer;

import com.xiaoshuidi.cloud.module.contract.mq.message.ContractOrderContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

//todo
@Component
@Slf4j
public class BillProducer {
    @Resource
    private StreamBridge streamBridge;
    //推送到MQ-账单

    // 推送到MQ-根据roomid来更新合同、账单、预定、租客信息。 其中合同、账单、预定有自己的实体类格式
    public void createRentOrderMQ(List<ContractOrderContext> contractOrderContexts) {

        for (ContractOrderContext contractOrderContext : contractOrderContexts) {
            streamBridge.send("rentOrderCreate-out-0", contractOrderContext);
        }


    }

}
